package com.atguigu.gmall.item.client.impl;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.client.ItemFeignClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component //将服务降级类放到ioc容器
public class ItemDegradeFeignClient implements FallbackFactory<ItemFeignClient> {


    /**
     * 查询详情信息,汇总详情页需要数据
     * @param throwable
     * @return
     */

    @Override
    public ItemFeignClient create(Throwable throwable) {
        log.error("service-item降级方法执行了,原因是---->{}",throwable.getMessage(),throwable);
        return new ItemFeignClient() {
            @Override
            public Result getItemInfo(Long skuId) {
                return null;
            }
        };
    }
}